import requests
import pandas as pd
url = 'https://movie.douban.com/j/chart/top_list'
params = {'type': 25, 'interval_id': '100:90', 'action': '', 'start': 0, 'limit': 50}
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'}
response = requests.get(url=url, params=params, headers=headers)
data = response.json()
print(data)
df = pd.DataFrame(data)
df = df[['rank', 'title', 'vote_count', 'score', 'url']]
df.columns = ['排名', '片名', '评价人数', '评分', '网址']
df.to_excel('豆瓣动画Top50.xlsx', index=False)
